package bacaTulis;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class ConvertToUpper {
	
	public static byte[] getData() throws Exception{

		int size;
		InputStream f1 = new FileInputStream("files.txt");
		StringBuffer sb = new StringBuffer();
		size = f1.available();
		for(int i=0 ; i<size ; i++){
			//System.out.print((char)f1.read());
			sb.append((char)f1.read());
		}
		System.out.println(sb);
		String a = sb.toString().toUpperCase();
		f1.close();
		byte[] buffer = new byte[12];
		for(int i=0 ; i<a.length() ; i++)
			buffer[i] = (byte) a.charAt(i);
		return buffer;
	}
	
	public static void main(String[] args) throws Exception{
		
		byte buf[] = getData();
		OutputStream f0 = new FileOutputStream("file1.txt");
		for(int i=0 ; i<buf.length ; i++){ f0.write(buf[i]); }
	}
}
